package com.sctvcloud.dongqu.ui.adapter.holder;

import android.content.Context;
import android.graphics.Typeface;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.TextUtils;
import android.text.style.StyleSpan;
import android.view.View;

import com.ruihang.generalibrary.ui.widget.CustomFontTextView;
import com.sctvcloud.dongqu.R;
import com.sctvcloud.dongqu.ui.util.IListShowData;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * Created by rh008 on 2017/7/13.
 */

public class OnlyTitleHolder extends BaseAbsHolder<IListShowData> {

    @BindView(R.id.item_only_title_title)
    protected CustomFontTextView title;

    public OnlyTitleHolder(Context context, View itemView) {
        super(context, itemView);
    }

    @Override
    protected void initInject() {
        ButterKnife.bind(this, itemView);
    }

    @Override
    public void setData(IListShowData iListShowData) {
        String text = iListShowData.getDataTitle();
        if (!TextUtils.isEmpty(text)) {
            Spannable string = new SpannableString(iListShowData.getDataTitle());
            // 粗体
            string.setSpan(new StyleSpan(Typeface.BOLD), 0, text.length(), Spannable.SPAN_INCLUSIVE_INCLUSIVE);
            title.setText(string);
        }
    }
}
